<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta name="author" content="wangyuguo">
		<title>选择油品</title>
		<script type="text/javascript" src="../script/common.js"></script>
		<script type="text/javascript">
			var qt = null;
			function load() {
				setPages(["listview","detviewdiv"]);
				var codes = getPara("ids");
				if (codes){
					var str = "";
					var list = codes.split(",")
					for (var i=0;i<list.length;i++){
						var c = list[i];
						if (str) str += ",";
						str += "'" + c +"'";
					}
					searchForm.selectedCode.value = str;
				}
				createTable();
				qt.showTable();
			}
			function createTable() {
				var columns = [
					{type:"checkbox"}
				]
				columns[1] = {render:function(v,r){
					return "<a href=# onclick=onView("+r[0]+")>"+v+"</a>";
				}}
				qt = new QueryTable("sel_goodsgroup", "searchForm", "datalist", columns,{
					exportable:false,
					columnsConf:false,
					paramFunc:function(){
						var params = Common.getValues("searchForm");
						params.name = params.name?"%"+params.name+"%":null; 
						return params;
					}
				});
			}
			function onView(id){
				DWR.call("goodsGroupService.getGoodsGroup",id,function(data){
					var group = data.group;
					var goods = data.goods;
					var strs = "";
					for (var i=0;i<goods.length;i++){
						var s = goods[i];
						if (strs) strs += ",";
						strs += s[2];
					}
					$("goodsGroupName").innerHTML = group.name;
					$("goodsGroupUniqueId").innerHTML = group.uniqueId;
					$("goodsNames").innerHTML = strs;
					switchPage("detviewdiv");
				},{blockScreen:true})
			}
			function onSave() {
				var list = qt.getBoxValue(true);
				if (list.length < 1) {showWarning("请选择一个商品组！");return;}
				dialogBackValue(list);
			}
		</script>
	</head>
	<body class="body" onload="load()">
		<div id="listview">
			<!--查询条件form-->
			<div class="searchForm">
				<form id="searchForm" name="searchForm">
					<input type="hidden" name="selectedCode" value="">
					<table cellSpacing="0" cellPadding="4" width="100%" border="0">
						<tr>
							<td>
								<label>商品组编码</label>
								<input type="text" maxlength="20" name="uniqueId">
							</td>
							<td>
								<label>商品组名称</label>
								<input type="text" name="name" maxlength="40">
							</td>
							<td><button type="button" onclick="qt.showTable()">查 询</button></td>
						</tr>
					</table>
				</form>
			</div>
			<div id="datalist"></div>
		</div>
		<div id="detviewdiv" style="display: none;">
			<div class="form">
				<div class="formTitle">商品组信息</div>
				<table cellSpacing="0" cellPadding="4" width="100%" border="0" class="viewTable">
					<tr>
						<td><label>商品组名称</label> <span id="goodsGroupName"></span></td>
						<td><label>商品组编号</label> <span id="goodsGroupUniqueId"></span></td>
					</tr>
					<tr>
						<td colspan="2"><label>商品信息</label> <span id="goodsNames"></span></td>
					</tr>
				</table>
			</div>
			<p>
				<button onclick="switchPage('listview');">返 回</button>
			</p>
		</div>
	</body>
</html>
